<template>
  <div class="films">
    <div class="films__header">
      <van-tabs
        v-model:active="activeRoute"
        @change="onChange"
        color="#ff5f16"
        title-active-color="#ff5f16"
        line-width="56px"
        line-heigth="2px"
      >
        <van-tab name="/films/now-playing" title="正在热映"></van-tab>
        <van-tab name="/films/coming-soon" title="即将上映"></van-tab>
      </van-tabs>
    </div>
    <div class="films__body">
      <router-view />
    </div>
  </div>
</template>
<script>
export default {
  name: "home-films",
};
</script>
<script setup>
import { ref } from "vue";
import { useRoute } from "vue-router";
import router from "../../router";

const route = useRoute();
const activeRoute = ref(route.path);
function onChange(data) {
  router.replace(data);
}
</script>

<style lang="scss" scoped>
.films {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;

  &__header {
    height: 50px;
  }
  &__body {
    flex: 1;
    overflow-y: auto;
  }
}
</style>
